#ifndef DOWNLOADITEM_H
#define DOWNLOADITEM_H

#include <QWidget>

class QUrl;
namespace Jcr
{
class DownloadItemPrivate;
class DownloadItem : public QWidget
{
    Q_OBJECT
public:
    explicit DownloadItem(QWidget *parent = 0);
    explicit DownloadItem(const QUrl& url, QWidget *parent = 0);

    void setUrl(const QUrl& url);
    QUrl url() const;

    void setSaveDir(const QString& saveDir);
    QString saveDir() const;

    void setSaveName(const QString& name);
    QString saveName() const;

    bool isFinished() const;

public slots:
    void start();

private slots:
    void onFinished();
    void onPercentDownloaded(float percent);
    void onButtonPressed();
    void showImagePreview(bool show);

private:
    DownloadItemPrivate* d_ptr;
    Q_DISABLE_COPY(DownloadItem)
};

} // namespace
#endif // DOWNLOADITEM_H
